package com.fare.taluo.core.domain;

import java.io.Serializable;

import org.apache.log4j.Logger;

import com.dayatang.domain.Entity;
import com.dayatang.domain.EntityRepository;
import com.dayatang.domain.InstanceFactory;

public class BaseEntity<T extends Entity> {
	protected static final String FDC_SEQ_GEN = "FDC_sequence_gen";
	protected static final String FDC_SEQUENCE = "FDC_sequence";

	protected Logger logger = Logger.getLogger(getClass());
	private static EntityRepository repository;

	public static <E extends Entity> E get(Class<E> clazz, Serializable ID) {
		return getRepository().get(clazz, ID);
	}

	public static EntityRepository getRepository() {
		if (repository == null) {
			repository = InstanceFactory.getInstance(EntityRepository.class);
		}
		return repository;
	}
}
